import request from '../utils/request'

export const findMenus = () => {
  return request({
    url: '/menus/findMenus',
    method: 'GET'
  })
}

export const insertMenu = (data) => {
  return request({
    url: '/menus/insertMenu',
    method: 'POST',
    data
  })
}

export const updateMenu = (data) => {
  return request({
    url: '/menus/updateMenu',
    method: 'POST',
    data
  })
}

export const deleteMenu = (data) => {
  return request({
    url: '/menus/deleteMenu',
    method: 'POST',
    data
  })
}

export const findRoles = () => {
  return request({
    url: '/roles/findRoles',
    method: 'GET'
  })
}

export const insertRole = (data) => {
  return request({
    url: '/roles/insertRole',
    method: 'POST',
    data
  })
}

export const updateRole = (data) => {
  return request({
    url: '/roles/updateRole',
    method: 'POST',
    data
  })
}

export const deleteRole = (data) => {
  return request({
    url: '/roles/deleteRole',
    method: 'POST',
    data
  })
}

// 获取账号列表
export const findUsers = (query?) => {
  return request({
    url: `/findUsers?${new URLSearchParams(query)}`,
    method: 'GET'
  })
}

export const insertUser = (data) => {
  return request({
    url: '/insertUser',
    method: 'POST',
    data
  })
}

export const updateUser = (data) => {
  return request({
    url: '/updateUser',
    method: 'POST',
    data
  })
}

export const deleteUser = (data) => {
  return request({
    url: '/deleteUser',
    method: 'POST',
    data
  })
}
